package com.shuaigef.springbootinit.controller;

import com.shuaigef.springbootinit.common.BaseResponse;
import com.shuaigef.springbootinit.common.ResultUtils;
import com.shuaigef.springbootinit.model.entity.Course;
import com.shuaigef.springbootinit.service.CourseService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/course")
@Slf4j
@RequiredArgsConstructor
public class CourseController {
    private final CourseService courseService;

    /**
     * 获取课程列表
     * @return 课程列表
     */
    @GetMapping("list")
    public BaseResponse<List<Course>> list() {
        return ResultUtils.success(courseService.list());
    }
}
